package com.novel.controller;

import com.novel.annotation.ResponseResult;
import com.novel.entiy.Novel;
import com.novel.entiy.Review;
import com.novel.entiy.dto.PageParams;
import com.novel.entiy.dto.ReviewDTO;
import com.novel.entiy.dto.StatisticsDTO;
import com.novel.entiy.vo.StatisticsVO;
import com.novel.service.ManagerService;
import com.novel.utils.PageResult;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author chihuo
 * @date 2022/4/10
 */
@ResponseResult
@RestController
@RequestMapping("/manager")
@RequiredArgsConstructor
public class ManagerController {

    private final ManagerService managerService;


    @ApiOperation("获取审核列表")
    @PostMapping("/getAllReview")
    public PageResult<Review> getAllReview(@RequestBody ReviewDTO reviewDTO) {
        return managerService.getAllReview(reviewDTO);
    }

    @ApiOperation("审核操作")
    @PostMapping("/review")
    public void review(@RequestBody ReviewDTO reviewDTO) {
        managerService.review(reviewDTO);
    }

    @ApiOperation("数据统计")
    @PostMapping("/statistics")
    public PageResult<StatisticsVO> statistics(@RequestBody StatisticsDTO statisticsDTO) {
        return managerService.statistics(statisticsDTO);
    }

    @ApiOperation("增加小说热度")
    @GetMapping("/addNovelHotNums/{novelId}/{hotNums}")
    public void addNovelHotNums(@PathVariable Long novelId, @PathVariable Long hotNums) {
        managerService.addNovelHotNums(novelId, hotNums);
    }

    @ApiOperation("获取全部小说列表")
    @PostMapping("/getNovelList")
    public PageResult<Novel> getNovelList(@RequestBody PageParams pageParams) {
        return managerService.getNovelList(pageParams);
    }


}
